<template>
  <div>
        <el-table :data="npcTaskMappingData" border style="width: 100%" :default-sort="{prop: 'vendorCode', order: 'descending'}">
            <el-table-column prop="npcTaskItem.materialNo" align="center" label="物料编码" width="150"></el-table-column>
            <el-table-column prop="npcTaskItem.materialName" align="center" label="物料名称" width="200"></el-table-column>
            <el-table-column prop="vendorCode" align="center" label="供应商编码" width="100"></el-table-column>
            <el-table-column prop="vendorName" align="center" label="供应商名称" width="300"></el-table-column>
            <el-table-column prop="currentNodeType" align="center" label="当前节点" width="100" :formatter="nodeTypeFormatter"></el-table-column>
            <el-table-column prop="confirmStatus" align="center" :formatter="confirmStatusStr" label="确认状态" width="100"></el-table-column>
            <el-table-column prop="rejectReason" align="center" label="驳回原因" width="250"></el-table-column>
            <el-table-column prop="confirmTime" align="center" label="确认日期" width="150"></el-table-column>
            <el-table-column prop="confirmUserName" align="center" label="确认人" width="150"></el-table-column>
            <el-table-column prop="sampleNumber" align="center" label="打样数量" width="100"></el-table-column>
            <el-table-column prop="unit" align="center" label="计量单位" width="100"></el-table-column>
            <el-table-column prop="requireTime" align="center" label="要求完成日期" width="150"></el-table-column>
            <el-table-column prop="completeStatus" align="center" :formatter="completeStatusStr" label="完成状态" width="100"></el-table-column>
            <el-table-column prop="sampleCount" align="center" label="打样次数" width="100"></el-table-column>

        </el-table>
  </div>
</template>
<script>
  export default {
    data() {
      return {
        // 初始化表格数据
        npcTaskMappingData: []
      };
    },
    mounted() {
        this.query();
    },
    methods: {
      query(){
        this.axios.post(this.lib.config.host.vendorDlv + "/vendormgt/npc/npcTaskItemVendor/query/" + this.$route.query.npcTaskId)
        .then((response)=> {
          this.npcTaskMappingData = response.data;
        })
        .catch((error)=> {
            console.log(error);
        });
      },
      confirmStatusStr(row,column){
        if(row.confirmStatus == 0){
          return '未确认'
        } else {
          return '已确认'
        }
      },
      completeStatusStr(row,column){
        if(row.completeStatus == 0){
          return '未完成'
        } else {
          return '已完成'
        }
      },
      nodeTypeFormatter(row, column){
         if(row.currentNodeType == 2){
          return '样品寄出'
        } else {
          return '检测报告'
        }
      }
    }
  }
</script>